Skip to main content

JDBC Driver Connection Strings for Java RESTful Engine

note

This is a guide to structuring your connection strings for SQLServer, MySQL, Oracle and DB2 databases, along with an example request bodies for each. If you don't know how to construct a request body, please refer to the template section of our swagger documentation.

SQL Server

In the request body, you want to have:

  • Type = ado
  • ClassName = com.microsoft.sqlserver.jdbc.SQLServerDriver The connection string should look like:
jdbc:sqlserver://{server_address};databaseName={database_name};username={username};password={password};

Here is an example request body:

<Template>
<ConnectionString>{template_connection_string}</ConnectionString>
<OutputFormat>pdf</OutputFormat>
<Datasources>
<Datasource>
<Name>{db_name}</Name>
<Type>ado</Type>
<ClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</ClassName>
<ConnectionString>jdbc:sqlserver://{server_address};databaseName={database_name};username={username};password={password};</ConnectionString>
</Datasource>
</Datasources>
</Template>

MySQL

In the request body, you want to have:

  • Type = ado
  • ClassName = com.mysql.cj.jdbc.Driver The connection string should look like:
jdbc:mysql://{server_address}/{server_name};username={username};password={password};

Here is an example request body:

<Template>
<ConnectionString>{template_connection_string}</ConnectionString>
<OutputFormat>pdf</OutputFormat>
<Datasources>
<Datasource>
<Name>{db_name}</Name>
<Type>ado</Type>
<ClassName>com.mysql.cj.jdbc.Driver</ClassName>
<ConnectionString>jdbc:mysql://{server_address}/{server_name};username={username};password={password};</ConnectionString>
</Datasource>
</Datasources>
</Template>

Oracle

In the request body, you want to have:

  • Type = ado
  • ClassName = oracle.jdbc.OracleDriver The connection string should look like:
jdbc:oracle:thin:@//{server_address};username={username};password={password};

Here is an example request body:

<Template>
<ConnectionString>{template_connection_string}</ConnectionString>
<OutputFormat>pdf</OutputFormat>
<Datasources>
<Datasource>
<Name>{db_name}</Name>
<Type>ado</Type>
<ClassName>oracle.jdbc.OracleDriver</ClassName>
<ConnectionString>jdbc:oracle:thin:@//{server_address};username={username};password={password};</ConnectionString>
</Datasource>
</Datasources>
</Template>

DB2

In the request body, you want to have:

  • Type = ado
  • ClassName = com.ibm.db2.jcc.DB2Driver The connection string should look like:
jdbc:db2://{server_address}/{server_name};username={username};password={password};

Here is an example request body:

<Template>
<ConnectionString>{template_connection_string}</ConnectionString>
<OutputFormat>pdf</OutputFormat>
<Datasources>
<Datasource>
<Name>{db_name}</Name>
<Type>ado</Type>
<ClassName>com.ibm.db2.jcc.DB2Driver</ClassName>
<ConnectionString>jdbc:db2://{server_address}/{server_name};username={username};password={password};</ConnectionString>
</Datasource>
</Datasources>
</Template>

PostgreSQL

caution

If you experience issues with connection to a POSTgreSQL database, you may need to place the JDBC driver in the Tomcat lib folder. You can see how to do this below the example request body.

In the request body, you want to have:

  • Type = ado
  • ClassName = org.postgresql.Driver

The connection string should look like:

jdbc:postgresql://{server_address}/{server_name};user={username};password={password};

Here is an example request body:

<Template>
<ConnectionString>{template_connection_string}</ConnectionString>
<OutputFormat>pdf</OutputFormat>
<Datasources>
<Datasource>
<Name>{db_name}</Name>
<Type>ado</Type>
<ClassName>org.postgresql.Driver</ClassName>
<ConnectionString>jdbc:postgresql://{server_address}/{server_name};user={username};password={password};</ConnectionString>
</Datasource>
</Datasources>
</Template>
Adding PostgreSQL connector to Tomcat
  1. Install the latest Java 8 PostgreSQL connector from their download page
  2. Place the .jar file in Tomcat's lib folder
    1. i.e. Windows: C:\Program Files\Apache Software Foundation\Tomcat 10.1\lib
    2. i.e. Linux: /usr/local/tomcat10-1/lib
  3. Restart your JavaRESTful Engine and you should be good to go!